/**
 * @Project : ProgrammingExercises
 * @Package : Leetcode
 * @File : Q0070.java
 * @Author : WangRuoyu
 * @Date 2023/1/12 10:01
 */

package leetcode;

public class Q0070 {
    public int climbStairs(int n) {
        int[] res = new int[n + 2];
        res[1] = 1;
        res[2] = 2;
        for (int i = 3; i <= n; i++) {
            res[i] = res[i - 1] + res[i - 2];
        }
        return res[n];
    }

    public static void main(String[] args) {
        Q0070 sl = new Q0070();
        int n = 4;
        System.out.println(sl.climbStairs(40));
    }
}
